// US Presidents from 1789 to 1841
// Note: This requires QuickCalc Basic Ver. 2.3.2 or higher.
// An example of how to use DATETIME functions and sliding text.

data George Washington, 2,22,1732, 4,30,1789, 3,4,1797, 12,14,1799
data John Adams,       10,30,1735, 3,4,1797,  3,4,1801, 7,4,1826
data Thomas Jefferson,  4,13,1743, 3,4,1801,  3,4,1809, 7,4,1826
data James Madison,     3,26,1751, 3,4,1809,  3,4,1817, 6,28,1836
data James Monroe,      4,28,1758, 3,4,1817,  3,4,1825, 7,4,1831
data John Quincy Adams, 7,11,1767, 3,4,1825,  3,4,1829, 2,23,1848
data Andrew Jackson,    3,15,1767, 3,4,1829,  3,4,1837, 6,8,1845
data Martin Van Buren,  12,5,1782, 3,4,1837,  3,4,1841, 7,24,1862
dim name$(8)
graph hscaletype=datetime,includeyaxis=0,landscape,clearance=.25
graph numberyaxis=0
i=8
y=7
while read(0) > 0
  read name$(i-1),b_mon, b_day, b_year, s_mon, s_day, s_year
  read e_mon, e_day, e_year, d_mon, d_day, d_year
  b = makedatetime (b_mon, b_day, b_year)  // born
  s = makedatetime (s_mon, s_day, s_year)  // started office
  e = makedatetime (e_mon, e_day, e_year)  // ended office
  d = makedatetime (d_mon, d_day, d_year)  // died
  
  shape top  = y +.50, bottom = y-.10
  shape left = b, right = d
  shape fillcolor = (0, 200, 200),rectangle
  shape left = s, right = e, filltype=solid
  shape fillcolor = (220, 220, 0), rectangle
  text x=b,x2=d, y=y+.1, string=name$(i-1),datasize=.4
  y = y - .75
  i = i-1
wend
// Title box:
t$="US Presidents\n1789 to 1841"
text size=24,string=t$,boxed,h=83,v=93

// put a little white space at the top of the graph

shape linestart=(s,8.5)
shape lineend = (e,8.5)
shape linecolor=(255,255,255),line // white line ("invisible")